package org.showminifier.web;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.Order;
import javax.jdo.annotations.Extension;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import com.google.appengine.api.users.User;
import com.google.appengine.api.datastore.Link;

import org.showminifier.core.Options;

/**
*
* Show Minifier
* Author: Shihua Ma <beijing.josh@gmail.com>
* Copyright (c) 2010 Shihua Ma
* Licensed under the MIT license.
*
*/

@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class WebContent {

	@PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    private Long id;
	
	@Persistent
	private User requestUser;
	
	@Persistent
	private String lable;
	
	@Persistent
	private Link url;	
	
	@Persistent
	private Date requestDate;
	
	@Persistent
	private String ipAddress;
	
	@Persistent
	private Options options;
	
	@Persistent
	private PageContent page;
	
	@Persistent(mappedBy = "webContent")
	@Order(extensions = @Extension(vendorName="datanucleus", key="list-ordering", value="browser desc, version desc,requestDate desc"))
	private List<PagePerformance> performance;

	
	public User getRequestUser() {
		return this.requestUser;
	}

	public void setRequestUser(User requestUser) {
		this.requestUser = requestUser;
	}

	public String getLable() {
		return this.lable;
	}

	public void setLable(String lable) {
		this.lable = lable;
	}

	public Link getUrl() {
		return this.url;
	}

	public void setUrl(Link url) {
		this.url = url;
	}

	public Date getRequestDate() {
		return this.requestDate;
	}

	public void setRequestDate(Date requestDate) {
		this.requestDate = requestDate;
	}

	public String getIpAddress() {
		return this.ipAddress;
	}

	public void setIpAddress(String ipAddress) {
		this.ipAddress = ipAddress;
	}

	public Options getOptions() {
		return this.options;
	}

	public void setOptions(Options options) {
		this.options = options;
	}

	public PageContent getPage() {
		return this.page;
	}

	public void setPage(PageContent page) {
		this.page = page;
	}

	public List<PagePerformance> getPerformance() {
		return this.performance == null ? new ArrayList<PagePerformance>() : this.performance;
	}

	public void setPerformance(List<PagePerformance> performance) {
		this.performance = performance;
	}

	public Long getId() {
		return this.id;
	}
	

}
